﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MMDemo
{
    public partial class GraphsValueForm : Form
    {
        public GraphsValueForm()
        {
            InitializeComponent();
        }
        /// <summary>
        /// 修改标签的名字
        /// </summary>
        public void ChangeLabelText(String text)
        {
            ValueLabel.Text = text;
        }
        public void ChangeTextValue(String value)
        {
            ValueText.Text = value;
        }
        public String GetTextValue()
        {
            return ValueText.Text.Trim();
        }
        private void OKBtn_Click(object sender, EventArgs e)
        {
            String text = ValueText.Text.Trim();
            try
            {
                Convert.ToInt32(text);
                PublicDataClass.IsInit = true;
                this.Close();
            }
            catch
            {
                MessageBox.Show("请输入数字!");
            }
        }

        protected override void WndProc(ref   Message m)
        {
            const int WM_SYSCOMMAND = 0x0112;
            const int SC_CLOSE = 0xF060;
            if (m.Msg == WM_SYSCOMMAND && (int)m.WParam == SC_CLOSE)
            {
                PublicDataClass.IsInit = false;
                this.Close();
                return;
            }
            base.WndProc(ref m);
        }
    }
}
